/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package me.zhengjie.suli.check.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import me.zhengjie.base.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * @author Allen Gao
 * @website https://eladmin.vip
 * @description /
 * @date 2023-04-23
 **/
@Entity
@Data
@Table(name = "check_detail")
public class CheckDetail extends BaseEntity implements Serializable {

    @Id
    @Column(name = "`id`")
    @ApiModelProperty(value = "ID")
    private String id;

    @Column(name = "`check_id`")
    @ApiModelProperty(value = "主表ID")
    private String checkId;

    @Column(name = "`check_detail_code`")
    @ApiModelProperty(value = "盘点明细编码")
    private String checkDetailCode;

    @Column(name = "`material_code`")
    @ApiModelProperty(value = "物料编码")
    private String materialCode;

    @Column(name = "`material_name`")
    @ApiModelProperty(value = "物料名称")
    private String materialName;

    @Column(name = "`lot_code`")
    @ApiModelProperty(value = "批次")
    private String lotCode;

    @Column(name = "`qty`")
    @ApiModelProperty(value = "库存数量")
    private BigDecimal qty;

    @Column(name = "`check_qty`")
    @ApiModelProperty(value = "盘点数量")
    private BigDecimal checkQty;

    @Column(name = "`different_qty`")
    @ApiModelProperty(value = "盘差")
    private BigDecimal differentQty;

    @Column(name = "`check_time`")
    @ApiModelProperty(value = "盘点时间")
    private Timestamp checkTime;

    @Column(name = "`unit_code`")
    @ApiModelProperty(value = "单位")
    private String unitCode;

    @Column(name = "`box_number`")
    @ApiModelProperty(value = "箱号")
    private String boxNumber;

    @Column(name = "`tray_code`")
    @ApiModelProperty(value = "箱号")
    private String trayCode;

    public void copy(CheckDetail source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
